<template>
  <div>
    <el-divider></el-divider>
    <div style="font-size:20px;text-align:left">
      <i class="el-icon-document-checked">药库管理</i>
    </div>
    <el-divider></el-divider>

    <el-row :gutter="20">
      <el-col :span="6"><el-input v-model="finish_price_search.drug_code" placeholder="请输入药品编号"></el-input></el-col>
      <el-col :span="6"><el-input v-model="finish_price_search.mnemonic_code" placeholder="请输入拼音助记码"></el-input></el-col>
      <el-col :span="6"><el-input v-model="finish_price_search.drug_name" placeholder="请输入药品名称"></el-input></el-col>
      <el-col :span="2"><el-button @click="getDrugInfo()">搜索</el-button></el-col>
      <el-col :span="4"> </el-col>
    </el-row>
    <el-divider></el-divider>
      <div style="font-size:20px;text-align:left">
        <el-button icon="el-icon-document-checked" type="primary" @click="addDrugs()">增加药品</el-button>
      </div>
    <el-divider></el-divider>
    <el-table :data="finish_price_patient" style="width:80%;margin-top:20px;" size="mini">
      <el-table-column type="index" width="50"></el-table-column>
      <el-table-column prop="drug_code" label="药品编码"></el-table-column>
      <el-table-column prop="drug_name" label="药品名称"></el-table-column>
      <el-table-column prop="drug_format" label="药品规格" width="180"></el-table-column>
      <el-table-column prop="drug_unit" label="包装单位" width="110"></el-table-column>
      <el-table-column prop="manufacturer" label="生产厂家" width="180"></el-table-column>
      <el-table-column prop="drug_price" label="单价" width="120"></el-table-column>
      <el-table-column width="120">
        <template slot-scope="scope">
          <el-button type="text" size="mini" @click="editDrugs(scope.$index,scope.row)">修改</el-button>
          <el-button type="text" size="mini" @click="delDrugs(scope.$index,scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <div style="margin-top:5px;text-align:right;width:80%">
      <el-pagination :page-size="finish_price_search.pageSize" :total="totalCount" @current-change="finishCheckPatientChange"
      layout="prev,pager,next">
      </el-pagination>
    </div>
  </div>
</template>
<script >
import qs from 'qs'
export default {
  methods:{
    //得到药品
    getDrugInfo(){
      this.$http.post("http://localhost:8091/getDrugInfo",qs.stringify(this.finish_price_search)).then(
        (resp)=>{
          this.finish_price_patient = resp.data.list;
          this.totalCount = resp.data.totalCount;
        }
      )
    },    
    //分页点击
    finishCheckPatientChange(nowPage){
        this.finish_price_search.nowPageNumber = nowPage;
        this.getDrugInfo();
    },  
    //修改
    editDrugs(index,row){
      this.$message({
        message:"没有修改 "+row.drug_name+" 的权限",
        type:"error"
      })
    },
    //删除
    delDrugs(index,row){
      this.$message({
        message:"没有删除 "+row.drug_name+" 的权限",
        type:"error"
      })
    },
    //增加
    addDrugs(){
      this.$message({
        message:"没有增加权限",
        type:"error"
      })
    }
  },
  mounted:function(){
    this.getDrugInfo();
  },
  data(){
    return {
      temp_select_patient:'',//记录最后点击的患者
      finish_price_search:{
        drug_code:'',
        mnemonic_code:'',
        drug_name:'',
        nowPageNumber:1,
        pageSize:10,//每页显示患者数量
      },
      update_check_input:{
        check_result:'',
        id:"",
        employee_id:'',
      },
      totalCount:0,
      finish_check_patient_select:[ ],
      finish_price_patient:[]
    }
  }
}
</script>